import QtQuick 1.0
//import ShellInvoker 1.0
import "../../../common/lib/kdeadmouseutils-build-desktop"

Item {
    id: listItem
    signal select(string id)
    
    width: 1024
    height: 600
    anchors.centerIn: parent
    property variant delegateCpt : Qt.createComponent('delegate.qml');
    
    
  
    QmlSetting{
      id:setting
      appName:'pluzz'
    }
    
    Rectangle {
	  id:rectHome
	  color: "#3E606F"
	  anchors.fill: parent
	  property int currentIndex : -1;
	  function navigue(dir){ //-1/1 ==>haut,bas
	      var nextIdx = currentIndex + dir;
	      for(var i=0;i<children.length;i++){
		var it = children[i];
		  if(nextIdx==it.index){
		    it.focus=true;
		    currentIndex=nextIdx;
		    return true;
		  }
	      }
	      return false;
	  }
    }
    
    Component.onCompleted: {
	var l = setting.getListKeys('podcastList');
	setting.beginGroup('podcastList');
	for(var i = 0;i<l.length;i++){
	  console.log('item:' + l[i]);
	  var it = delegateCpt.createObject(rectHome);
	  it.count=l.length;
	  it.name=l[i];
	  it.label=setting.value(l[i]+'/label');
	  it.url=setting.value(l[i]+'/url');
	  it.index=i;
	}
	setting.endGroup();
	rectHome.navigue(1);
	//improuve this
    }
      
       
   
        
}
